package _021_10_4

import (
	"fmt"
	"sort"
)

type pairSlice []pair

type pair struct {
	item byte
	num  int
}

func (item pairSlice) Swap(i, j int) {
	temp := item[i]
	item[i] = item[j]
	item[j] = temp
}
func (item pairSlice) Len() int {
	return len(item)
}
func (item pairSlice) Less(i, j int) bool {
	return item[i].num < item[j].num
}
func notClosed(s string) {
	itemM := make(map[byte]int)
	for _, item := range s {
		_, ok := itemM[byte(item)]
		if !ok {
			itemM[byte(item)] = 0
			continue
		}
		itemM[byte(item)] += 1
	}
	var data pairSlice
	for item, num := range itemM {
		data = append(data, pair{
			item: item,
			num:  num,
		})
	}

	sort.Sort(data)
	fmt.Println(data)
	//alphaNum := make([]int, 10)
	//for _, i := range itemM {
	//	fmt.Println(i)
	//}
}
